
package com.eci.context.context.filter;

import com.eci.common.asset.kit.JwtUserInfo;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class SessionHolder {
    private final static ThreadLocal<String> tidHolder = new InheritableThreadLocal<>();

    private final static ThreadLocal<String> userIpHolder = new InheritableThreadLocal<>();

    private final static ThreadLocal<JwtUserInfo> userHolder = new InheritableThreadLocal<>();

    private final static ThreadLocal<String> userStrHolder = new InheritableThreadLocal<>();

    public static void setUserIp(String userIp){
        userIpHolder.set(userIp);
    }

    public static String getUserIp(){
        return userIpHolder.get();
    }

    public static void setTidHolder(String tid){
        tidHolder.set(tid);
    }

    public static void setUser(JwtUserInfo user){
        userHolder.set(user);
    }

    public static JwtUserInfo getUser(){
        return userHolder.get();
    }

    public static void setUserStr(String user){
        userStrHolder.set(user);
    }

    public static String getUserStr(){
        return userStrHolder.get();
    }


}
